Skip to content

Refactor code using pyupgrade for Python 3.6 #770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 24, 2021

Conversation

adamantike
Copy link
Contributor

Description

This diff is the result of applying the following command to the project:

find . -type f -name "*.py" -exec pyupgrade --py36-plus '{}' +

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Existing CI test coverage.

Does This PR Require a Core Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

This diff is the result of applying the following command to the
project:

```shell
find . -type f -name "*.py" -exec pyupgrade --py36-plus '{}' +
```
@adamantike adamantike requested a review from a team October 23, 2021 04:26
@owais owais added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Oct 23, 2021
@@ -37,7 +37,6 @@ def main():
root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
with open(
os.path.join(root_path, _template_dir, _template_name),
"r",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we removing this?

Copy link
Contributor Author

@adamantike adamantike Oct 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read mode is the default parameter even since Python 2, so pyupgrade removes it (https://github.com/asottile/pyupgrade#redundant-open-modes). I've also found most of the open() usages in the repo omit the read mode, so this should bring more consistency.

@owais owais merged commit 07c52aa into open-telemetry:main Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants